const getRouter = function (path, routers) {
  const arr = path.split('/')
  const length = arr.length
  let router = { children: routers }
  for (let i = 1; i < length; i++) {
    const path = arr[i] || ''
    let str = ''
    if (i === 1) str = `/${arr[i]}`
    else if (i === length - 1) str = path.split('?')[0]
    else str = path
    const children = router.children
    if (children) router = children.find(item => item.path === str)
  }
  return router
}
export {
  getRouter
}
